package day20171009;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Client {
    public static void main(String args[]) {
        myJFrame obj = new myJFrame();
        obj.createJFrame();
    }
}

class myJFrame {
    public void createJFrame() {
        JFrame jframe = new JFrame("一个框架应用");
        Container panel = jframe.getContentPane();
        panel.setLayout(new FlowLayout());
        panel.add(new JButton("你好!"));
        jframe.setSize(400, 200);
        jframe.setVisible(true);
        jframe.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
